package com.hf.lookatme.zpresenter;

import android.content.Context;
import android.content.Intent;

import com.hf.lookatme.zbean.AdvertisementData;
import com.hf.lookatme.zmodel.IModel_AdvertisementsData;
import com.hf.lookatme.zmodel.impls.Model_AdvertisementsData;
import com.hf.lookatme.zmodel.loadlistener.OnLoadAdvertisementDataListener;
import com.hf.lookatme.zview.interfaces.IView_Fragment_Main;

import java.util.List;

/**
 * Created by JoeShiguang on 2015/5/20.
 */
public class Present_Fragment_Main implements OnLoadAdvertisementDataListener {

  private IView_Fragment_Main view_fragment_main;

  private IModel_AdvertisementsData model_AdvertisementsData;

  public Present_Fragment_Main(IView_Fragment_Main view_fragment_main) {

    this.view_fragment_main = view_fragment_main;
    this.model_AdvertisementsData = new Model_AdvertisementsData();
  }

  public void getAdvertisementData(Context context) {

    model_AdvertisementsData.getAdvertisementsData(context, this);
  }

  /**
   * 发送Intent
   *
   * @param packageContext
   */
  public void doIntent(Context packageContext, Class<?> cls) {

    Intent intent = new Intent();
    intent.setClass(packageContext, cls);
    packageContext.startActivity(intent);
  }

  @Override
  public void onLoadAdvertisementDataSuccess(List<AdvertisementData> list_advertisementData) {

    view_fragment_main.startAdvertisementScroll(list_advertisementData);
  }

  @Override
  public void onLoadAdvertisementDataFailed(String failedInfo) {

  }
}
